package com.wman.sheep.mvp.base;

import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.wman.sheep.R;
import com.wman.sheep.mvp.view.AppDelegate;
import com.wman.sheep.widget.refreshlayout.PullRefreshLayout;

/**
 * 列表基类视图
 */
public class BasePullListDelegate extends AppDelegate {

    public RecyclerView mRecyclerView;
    public PullRefreshLayout mRecyclerRefreshLayout;

    @Override
    public int getRootLayoutId() {
        return R.layout.base_pull_list_delegate;
    }

    @Override
    public void initWidget() {
        super.initWidget();
        mRecyclerRefreshLayout = get(R.id.refreshlayout);

        mRecyclerView = get(R.id.recyclerView);
        mRecyclerView.setItemAnimator(new DefaultItemAnimator());
        mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity(),
                LinearLayoutManager.VERTICAL, false));
    }

    public LinearLayoutManager getLayoutManager() {
        return (LinearLayoutManager) mRecyclerView.getLayoutManager();
    }

}
